Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n0/jfs/t1/246979/26/16936/66901/66bead02F7f3f7aeb/d7790261ed435e6e.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/220829/4/41955/66270/664c7ebdF63647708/62ca025328d88a60.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/240299/22/7170/22944/66160c9bFd104271c/e53d4d35825e3335.jpg.avif',
      'https://img14.360buyimg.com/n0/jfs/t1/94869/34/46975/70369/66bead02F3b1f4811/980e11a214afa6d7.jpg.avif',
      'https://img12.360buyimg.com/n1/s450x450_jfs/t1/194750/23/45897/69225/664c7ebdF97b5b823/2c811d392f30f002.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img12.360buyimg.com/n1/s450x450_jfs/t1/190444/4/44268/110608/66160c9bFbd23ba52/6c76610f0fefe403.jpg.avif",
      "https://img12.360buyimg.com/n1/s450x450_jfs/t1/220779/20/39719/78767/66160c9aF1fefa1df/8118299532de4b41.jpg.avif",
      "https://img12.360buyimg.com/n1/s450x450_jfs/t1/173643/32/31220/58463/66160c98F30145ce2/4ab7d96f7a8032d7.jpg.avif",
      "https://img12.360buyimg.com/n1/s450x450_jfs/t1/226462/18/14915/94042/66160c98F2948670f/33e06acf8dbbeced.jpg.avif",
      "https://img12.360buyimg.com/n1/s450x450_jfs/t1/246238/8/7231/64379/66160c9aF12424efc/b3285dc1801fc728.jpg.avif",
      "https://img12.360buyimg.com/n1/s450x450_jfs/t1/218580/12/39435/52768/66160c99F49d83fb3/4728e00398c22f21.jpg.avif",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})